package com.cr.business.controller;

import com.cr.business.domain.TbSupervisionRankingInfo;
import com.cr.business.service.ITbSupervisionRankingInfoService;
import com.cr.common.annotation.Log;
import com.cr.common.core.controller.BaseController;
import com.cr.common.core.domain.AjaxResult;
import com.cr.common.core.page.TableDataInfo;
import com.cr.common.enums.BusinessType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 网格化监管排名信息Controller
 * 
 * @author tang
 * @date 2025-10-28
 */
@RestController
@RequestMapping("/ranking/supervision")
public class TbSupervisionRankingInfoController extends BaseController
{
    @Resource
    private ITbSupervisionRankingInfoService tbSupervisionRankingInfoService;

    /**
     * 查询网格化监管排名信息列表
     */
    @PreAuthorize("@ss.hasPermi('ranking:supervision:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbSupervisionRankingInfo tbSupervisionRankingInfo)
    {
        startPage();
        List<TbSupervisionRankingInfo> list = tbSupervisionRankingInfoService.selectTbSupervisionRankingInfoList(tbSupervisionRankingInfo);
        return getDataTable(list);
    }

    /**
     * 新增网格化监管排名信息
     */
    @PreAuthorize("@ss.hasPermi('ranking:supervision:add')")
    @Log(title = "网格化监管排名信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbSupervisionRankingInfo tbSupervisionRankingInfo)
    {
        return toAjax(tbSupervisionRankingInfoService.insertTbSupervisionRankingInfo(tbSupervisionRankingInfo));
    }

    /**
     * 修改网格化监管排名信息
     */
    @PreAuthorize("@ss.hasPermi('ranking:supervision:edit')")
    @Log(title = "网格化监管排名信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbSupervisionRankingInfo tbSupervisionRankingInfo)
    {
        return toAjax(tbSupervisionRankingInfoService.updateTbSupervisionRankingInfo(tbSupervisionRankingInfo));
    }

    /**
     * 删除网格化监管排名信息
     */
    @PreAuthorize("@ss.hasPermi('ranking:supervision:remove')")
    @Log(title = "网格化监管排名信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbSupervisionRankingInfoService.deleteTbSupervisionRankingInfoByIds(ids));
    }
}
